package com.ray.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ray.bean.PageParamBean;
import com.ray.exception.ServiceException;
import com.ray.pojo.MyUser;
import com.ray.service.PageParamService;
import com.ray.util.RequestUtil;
import com.ray.util.ResponseUtil;

@Controller
@RequestMapping("pageParam")
public class PageParamController {
	@Autowired
	PageParamService pageParamService;
	
	@RequestMapping("/setReachParam")
	@ResponseBody
	public void setReachParam(PageParamBean pageParamBean,HttpServletRequest request) throws ServiceException {
		System.out.println(pageParamBean.getReachParam());
		MyUser myUser=RequestUtil.getLoginUser(request);
		pageParamBean.setUserId(myUser.getUserId());
		pageParamService.setReachParam(pageParamBean);
	}
	
	@RequestMapping("/getReachParam")
	@ResponseBody
	public Map getReachParam(HttpServletRequest request) throws ServiceException {
		MyUser myUser=RequestUtil.getLoginUser(request);
		return ResponseUtil.ResponseResult(pageParamService.getReachParam(myUser.getUserId()));
	}
	

}
